#include <cstdio>
#include <cstdlib>
#include "gtest/gtest.h"
class IntCell
{
public:
	explicit IntCell(int initialvalue = 0)
	{
		storeValue = new int(initialvalue);
	}

	IntCell(const IntCell& pIntCell)
	{
		storeValue = new int(*pIntCell.storeValue);
	}
	~IntCell(){
		if (storeValue)
		{
			delete storeValue;
		}
	}
	
	IntCell& operator =(const IntCell& iIntCell)
	{
		if (&iIntCell != this)
		{
			this->storeValue = new int(*iIntCell.storeValue);
		}
	}
	int read() const 
	{
		return *storeValue;
	}
	void write(int x)
	{
		*storeValue = x;
	}

private:
	int *storeValue;
};

TEST(IntCellTest, test1)
{
	IntCell a(2);
	IntCell b = a;

	double ldouble = 3.1f;
	IntCell c(ldouble);//no error. but the value is 3
}